LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file Area.php

Documentation is available at Area.php

  1. <?php require_once 'index.php'?>
  2. <h3>Area</h3>
  3. <?php
  4. $currentApps $admin->perm->getApplications();
  5. if  (empty($currentApps)) {
  6.     echo 'Run the <b>Application</b> test first<br />';
  7.     exit;
  8. }
  9.  
  10. // Add
  11. $id array_rand($currentApps);
  12. for ($i = 1; $i < 4; $i++{
  13.     $data = array(
  14.         'application_id' => $currentApps[$id]['application_id'],
  15.         'area_define_name' => 'AREA'.rand(),
  16.     );
  17.     $areaId  $admin->perm->addArea($data);
  18.  
  19.     if ($areaId === false{
  20.         echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  21.     else {
  22.         echo 'Created Area Id <b>' $areaId '</b><br />';
  23.     }
  24. }
  25.  
  26. // Get
  27. $currentAreas $admin->perm->getAreas();
  28.  
  29. if ($currentAreas === false{
  30.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  31. else {
  32.     echo 'These are our current areas:';
  33.     Var_Dump::display($currentAreas);
  34.     echo '<br />';
  35. }
  36.  
  37. // Remove
  38. $id array_rand($currentAreas);
  39. $filters = array('area_id' => $currentAreas[$id]['area_id']);
  40. $rmArea $admin->perm->removeArea($filters);
  41.  
  42. if ($rmArea === false{
  43.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  44. else {
  45.     echo '<b>Area3</b> was removed<br />';
  46.     unset($currentAreas[$id]);
  47. }
  48.  
  49. // Update
  50. $id array_rand($currentApps);
  51. $id2 array_rand($currentAreas);
  52. $data = array(
  53.     'area_define_name' => 'AREA2_' $currentAreas[$id2]['area_id''updated',
  54.     'application_id' => $currentApps[$id]['application_id'],
  55. );
  56.  
  57. $id array_rand($currentAreas);
  58. $filters = array('area_id' => $currentAreas[$id]['area_id']);
  59. $upArea $admin->perm->updateArea($data$filters);
  60.  
  61. if ($upArea === false{
  62.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  63. else {
  64.     echo '<b>Area2</b> was updated<br />';
  65.     $params = array('filters' => array('area_id' => $currentAreas[$id]['area_id']));
  66.     $result $admin->perm->getAreas($params);
  67.  
  68.     if ($result === false{
  69.         echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  70.     else {
  71.         Var_Dump::display($result);
  72.     }
  73. }
  74.  
  75. // Get
  76. $currentAreas $admin->perm->getAreas();
  77.  
  78. if ($currentAreas === false{
  79.     echo '<strong>Error on line: '.__LINE__.' last query: '.$admin->perm->_storage->dbc->last_query.'</strong><br />';
  80. else {
  81.     echo 'These are our current areas:';
  82.     Var_Dump::display($currentAreas);
  83.     echo '<br />';
  84. }
  85. echo '<hr />';

Documentation generated on Mon, 11 Mar 2019 14:00:08 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.